﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

/// <summary>
/// Author toanvt
/// CreatedDate 08/12/2011
/// </summary>
public partial class Administrator_AdminUserDetail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //Lấy thông tin user
            MembershipUser theUser = Membership.GetUser(HttpContext.Current.User.Identity.Name);

            //trường hợp không lấy được thông tin thì trở lại trang chủ
            if (theUser == null)
            {
                Response.Redirect("AdminIndex.aspx");
            }
            else
            {
                //Lấy thông tin role
                String role = Roles.GetRolesForUser(theUser.UserName)[0];

                if (role == HangSo.ROLE_ADMIN)
                    this.ckAdmin.Checked = true;
                else
                    this.ckAdmin.Checked = false;

                this.txtEmail.Text = theUser.Email;
                this.txtUserName.Text = theUser.UserName;
                this.txtEmail.ReadOnly = true;
                this.txtUserName.ReadOnly = true;
                this.ckAdmin.Enabled = false;
            }
        }
    }

    protected void btnChangePWD_Click(object sender, EventArgs e)
    {
        Response.Redirect("AdminChangePWD.aspx");
    }
}